include ../config.local
include $(RULESDIR)/config_comm
include ./head.rules
include $(RULESDIR)/rule.local

DEMOSRCS    = $(wildcard *.cpp)

DEMOOBJS    :=  $(DEMOSRCS:%.cpp=%.o)

DEMOTARGET	:= $(TARGETDIR)/bin/test_tool_BM6J58

#NFSTARGET := $(TTOP)/../../nfs/test_tool_BM6J58

#applibs-y += -L$(TOPUSERLIBDIR) -llog4cplus
#applibs-y += -L$(TARGETDIR)/lib -ldswlivevideo
#applibs-y += -ldswrecoder
#applibs-y += -lssl
#applibs-y += -lcrypto -lz

#applibs-y += -ldswhashtable
#applibs-y += -L$(TOPGMLIBDIR) -lgm

applibs-y += -L$(TARGETDIR)/lib -lmarkup
applibs-y += -ljson

#applibs-y += -lmarkup

#applibs-y += -lstdc++

#applibs-y += -lpthread -lm

#applibs-y += -ldl -lnsl -lrt -lresolv

applibs-y += -lmenu -lncurses

all: $(DEMOTARGET)

include $(RULESDIR)/rule.local

$(DEMOOBJS): %.o :%.cpp
	@echo "ARCHDEF="$(ARCHDEF)
	@echo " CC $<"
	$(CC) -c $(CFLAGS) -o $@ $<

$(DEMOTARGET):$(DEMOOBJS)
	@echo "Building Targets....."

	$(CC) $(CXXFLAGS) -Wall -o $(DEMOTARGET) $(DEMOOBJS) $(applibs-y)
	$(STRIP) $(DEMOTARGET)
#	$(TARGETDIR)/upx/upx $(DEMOTARGET)

#	/bin/cp $(DEMOTARGET) $(NFSTARGET)
	/bin/cp ../libusr/lib_json/*.json $(TARGETDIR)/bin/
	#/bin/cp ../libusr/lib_json/*.txt $(TARGETDIR)/bin/

clean: 
	/bin/rm -f *.o $(DEMOTARGET) #$(NFSTARGET)

